<template>
  <div class="bigbox">
    
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
      <el-form-item label="年级:" prop="region">
        <el-select v-model="ruleForm.region" placeholder="年级">
          <el-option label="一年级" value="一年级"></el-option>
          <el-option label="二年级" value="二年级"></el-option>
          <el-option label="三年级" value="三年级"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="学科:" prop="subject">
        <el-select v-model="ruleForm.subject" placeholder="学科">
          <el-option label="语文(一年级)" value="语文(一年级)"></el-option>
          <el-option label="数学(一年级)" value="数学(一年级)"></el-option>
        </el-select>
      </el-form-item>


      <el-form-item label="名称:" prop="name">
        <el-input v-model="ruleForm.name"></el-input>
      </el-form-item>


      <el-form-item label="封面:" prop="name" >
        <!-- <el-input v-model="ruleForm.name"></el-input> -->
        <el-button type="success" class="shangchuananniu">上传图片</el-button>
        <input type="image" src="" class="pictureArea">
      </el-form-item>

      <el-form-item label="视频:" prop="name" >
        <!-- <el-input v-model="ruleForm.name"></el-input> -->
        <el-button type="success" class="shangchuanshipin">上传视频</el-button>
        <video src=""></video>
      </el-form-item>

      <el-form-item label="试卷:" prop="name" >
        <el-button type="success">上传试卷</el-button>
      </el-form-item>
    </el-form>

    <el-button type="primary">提交</el-button>
    <el-button>重置</el-button>
  </div>
</template>

<script>
export default {
  data(){
    return{
      ruleForm:{
        name: '',
          region: '',
          subject: '',
      },
      rules:{
        region: [
            { required: true, message: '请选择年级', trigger: 'change' }
          ],
        subject: [
          { required: true, message: '请选择学科', trigger: 'change' }
        ],
        name: [
          { required: true, message: '请输入课程名', trigger: 'blur' },
          { min: 0, max: 20, message: '长度在 0 到 20 个字符', trigger: 'blur' }
        ],
      }
    }
  },

  methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
}
</script>

<style scoped>
  .bigbox{
    background-color: #fff;
    padding: 30px;
  }
  .pictureArea{
    width: 350px;
    height: 200px;
    margin-left: 50px;
  }
  .shangchuananniu{
    transform:translateY(-100px) ;
  }
  .shangchuanshipin {
    transform:translateY(-70px) ;
  }
  video{
    width: 300px;
    height: 150px;
    border: 1px solid rgb(219, 216, 216);
    margin-left: 50px;
  }
  .el-button--primary{
    margin-left: 100px;
  }
</style>